<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: Iurii_Miedviediev
  Date: 9/23/2014
  Time: 1:54 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%@ include file="../base/headconfig.jsp" %>

    <link href="/css/orderdetails.css" rel="stylesheet">
    <link href="/css/orders.css" rel="stylesheet">

    <title>Order #${order.id}</title>
</head>
<body>
<%@ include file="../base/header.jsp" %>

<!-- Content -->
<div class="intro-header">

    <div class="container">

        <h2>Order #${order.id}</h2>

        <div id="booklist">
            <c:set var="sum" value="${0}"/>
            <c:forEach var="book" items="${order.items}">
                <c:set var="sum" value="${sum + book.price}"/>

                <div class="pricetab">
                    <h5> ${book.title} </h5>
                    <div class="price">
                        <img width="120px" height="150px" src="/book-cover/${book.id}">
                    </div>
                    <div class="infos">
                        <h4> $${book.price/100} </h4>
                        <h4> ${book.author}</h4>
                    </div>
                    <div class="pricefooter">
                        <div class="button">
                            <a href="/book?id=${book.id}"> View Book Info </a>
                        </div>
                    </div>
                </div>

            </c:forEach>
        </div>

        <table style="width: 360px;">
            <thead>
            <tr>
                <th>Total price</th>
                <th>$${sum/100}</th>
                <th rowspan="3">
                    <a target="_blank" href="/order/${order.id}?pdf"> <img width="100" height="100" src="/order/qr/${order.id}">
                        <br>
                        Click to Download
                    </a>
                </th>
            </tr>
            <tr>
                <th>Order Status</th>
                <th><span class="orderstatus">${order.status}</span></th>
            </tr>
            <tr>
                <th>Date of creation</th>
                <th><fmt:formatDate value="${order.dateOfCreation}" pattern="dd/MM/ HH:mm"/></th>
            </tr>
            </thead>
        </table>


    </div>
    <!-- /.container -->
</div>
<!-- /.Content -->

<%@ include file="../base/footer.jsp" %>
</body>
</html>
